package rpg.manager
{
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.utils.Dictionary;

	import rpg.resource.Resources;
	import rpg.uiView.shortCut.ShortCutView;

	import ui.Component;

	public class UIManager
	{
		public static var shortcutUi : Class;

		public static var talkCursor : Class;
		public static var selectCursor : Class;
		public static var attackCursor : Class;
		public static var repairCursor : Class;
		
		public static var loadMc : Class;

		private static var canvas : Sprite;

		public static const View_SHORTCUT : int = 1;

		public static var viewMap : Dictionary = new Dictionary();

		public function UIManager()
		{
			init();
		}

		public static function init() : void
		{
		}

		public static function initView() : void
		{
			addView(View_SHORTCUT);
		}

		public static function addView(type : int) : Component
		{
			var view : Component = getView(type);
			canvas.addChild(view);
			return view;
		}

		public static function getView(type : int) : Component
		{
			if(viewMap[type])
			{
				return viewMap[type];
			}
			switch(type)
			{
				case View_SHORTCUT:
					viewMap[type] = new ShortCutView();
					break;
			}
			return viewMap[type];
		}

		public static function getContainer() : Sprite
		{
			if(canvas == null)
				canvas = new Sprite();
			return canvas;
		}

		public static function initClass(res : Resources) : void
		{
			talkCursor = res.getClass('UiTalkCursor');
			selectCursor = res.getClass('UiSelectCursor');
			attackCursor = res.getClass('UiAttackCursor');
			repairCursor = res.getClass('UiRepairCursor');
			
			loadMc = res.getClass("LoadIco2");
		}

	}
}